<template>
    <van-cell class="comment-item">
      <van-image
        slot="icon"
        round
        class="avatar"
        fit="cover"
        style="margin-right: 10px;"
        :src="commentObj.aut_photo"
      />
      <div slot="title" class="title-wrap"></div>
      <div class="user-name">{{commentObj.aut_name}}</div>
        <van-button
          class="like-btn"
          :class="{
              liked: commentObj.is_liking
          }"
          :icon="commentObj.is_liking ? 'good-job' : 'good-job-o'"
          :loading="isLoadingState"
        >{{commentObj.like_count || '赞'}}</van-button>
      <div slot="label">
        <div style="color: #363636;">{{commentObj.content}}</div>
        <div class="bottom-info">
          <span class="comment-pubdate">{{commentObj.pubdate | relativeTime}}</span>
          <van-button
          class="reply-btn"
          round
          >回复 {{commentObj.reply_count}}</van-button>
        </div>
      </div>
      <van-icon slot="right-icon" name="like-o" />
    </van-cell>
</template>

<script>
export default {
  name: 'CommentItem',
  props: {
    commentObj: {
      type: Object,
      required: true
    }
  },
  data () {
    return {
      // 加载状态
      isLoadingState: false
    }
  }
}
</script>

<style lang="less" scoped>
.comment-item {
  .avatar {
    width: 72px;
    height: 72px;
    margin-right: 25px;
  }
  .title-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    .user-name {
      color: #406599;
      font-size: 26px;
    }
  }
  .comment-content {
    font-size: 32px;
    color: #222222;
    word-break: break-all;
    text-align: justify;
  }
  .comment-pubdate {
    font-size: 19px;
    color: #222;
    margin-right: 25px;
  }
  .bottom-info {
    display: flex;
    align-items: center;
  }
  .reply-btn {
    // width: 135px;
    height: 48px;
    line-height: 48px;
    font-size: 21px;
    color: #222;
  }
  .like-btn {
    height: 30px;
    padding: 0;
    border: none;
    font-size: 19px;
    line-height: 30px;
    margin-right: 7px;
    .van-icon {
      font-size: 30px;
    }
    &.liked {
      color: #e5645f;
    }
  }
}
</style>
